/*
  (C) 2005 Adam D. Bradley

  This program is free software; you can redistribute it and/or
  modify it under the terms of Version 2 of the GNU General Public 
  License.
  
  This library is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  General Public License for more details.
  
  You should have received a copy of the GNU Library General Public
  License along with this library; if not, write to the Free
  Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/

package step;

import java.net.URI;
import java.util.ArrayList;

import snobject.snObject;
import step.ReceiverSocketNode;
import step.exceptions.STEPException;

public class ReceiverPostSocketNode extends ReceiverSocketNode
{
    public ReceiverPostSocketNode(String id, String fromID, URI fromURI) 
    {
	super(id, fromID, fromURI);
    }
	
	public ReceiverPostSocketNode(String fromID, URI fromURI) {
		super(fromID, fromURI);
	}

	public String GetInfoXML() { 
		return super.GetInfoXML("POST", "receiver", FromURI); 
	}
	
    public void POST(snObject nv)
    {
	rt_evaluated = true;
	SetValue(nv);
	PushResult();
    }

    public boolean IsEnabled()
    {
	return false;
    }

    public void Evaluate() throws EvaluationFailure
    {
	throw new EvaluationFailure(this, "This node is never enabled!");
    }


    public void Write(java.io.OutputStream out, int depth) throws java.io.IOException
    {
	WriteBasis(out, depth, "type=\"receiver\" method=\"post\"");
    }

	@Override
	public void validate(Graph g, ArrayList<STEPException> compilationErrors) {
		// TODO Auto-generated method stub
		
	}
	
	@Override
	public Node ShallowCopy() {
		ReceiverPostSocketNode cn = new ReceiverPostSocketNode(ID, FromID, FromURI);
		Node.CopyNonRTPropertiesFromAtoB(this,cn);
		return cn;
	}
}

